# Maintainer: Jürgen Pfeifer <juergen@familiepfeifer.de>
# Contributor: Tim S <stahta01@gmail.com>

_realname=gprbuild-gpl
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2017
pkgrel=1
pkgdesc="Software tool designed to help automate the construction of multi-language systems (mingw-w64)"
arch=('any')
provides=("${MINGW_PACKAGE_PREFIX}-${_realname%-*}")
license=('GPL3')
url="https://www.adacore.com/gnatpro/toolsuite/gprbuild/"
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc-ada"
             "${MINGW_PACKAGE_PREFIX}-xmlada"
             "${MINGW_PACKAGE_PREFIX}-gprbuild-bootstrap-git")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-ada"
         "${MINGW_PACKAGE_PREFIX}-xmlada")
conflicts=("${MINGW_PACKAGE_PREFIX}-gprbuild-bootstrap")
source=("${_realname}"::"git+https://github.com/AdaCore/gprbuild.git#branch=gpl-${pkgver}")
sha256sums=('d51659454bc0aaf1a9a9f1d05aab469a1f3d900065a4542123d3a59ab067275d')

prepare() {
  cd ${srcdir}/gprbuild-gpl-${pkgver}-src

  #./bootstrap.sh
}

build() {
  cd ${srcdir}/gprbuild-gpl-${pkgver}-src

  ./configure \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX}

    make
}

package() {
  cd ${srcdir}/gprbuild-gpl-$pkgver-src
  make prefix="${pkgdir}${MINGW_PREFIX}" INSTALL=cp install

  # Copy License Files
  mkdir -p ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}
  cp -pf COPYING* ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/
}
